package com.jming.jike.controller.front;

import com.jming.jike.common.ResponseResult;
import com.jming.jike.service.front.ClickMealService;
import com.jming.jike.vo.front.CategoryVO;
import com.jming.jike.vo.front.MealDetailVO;
import com.jming.jike.vo.front.MealVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author jinming.zhang
 * @version 0.0.1
 * @date 2022/05/01
 */
@RestController
@RequestMapping("/clickMeal")
@Api(tags = "点餐页面相关接口", value = "/clickMeal")
public class ClickMealController {

    @Resource
    private ClickMealService clickMealService;

    @GetMapping("/categoryList")
    @ApiOperation(value = "获取菜品分类列表", notes = "获取菜品分类列表", produces = "application/json", httpMethod = "GET")
    public ResponseResult<List<CategoryVO>> categoryList() {

        return ResponseResult.success(clickMealService.categoryList());
    }

    @GetMapping("/mealList/{categoryId}")
    @ApiOperation(value = "根据菜品分类id获取菜品列表", notes = "根据菜品分类id获取菜品列表", produces = "application/json", httpMethod = "GET")
    public ResponseResult<List<MealVO>> mealList(@PathVariable("categoryId") Long categoryId) {

        return ResponseResult.success(clickMealService.mealList(categoryId));
    }

    @GetMapping("/mealDetail/{soleId}")
    @ApiOperation(value = "根据soleId获取菜品/套餐详情", notes = "根据soleId获取菜品/套餐详情", produces = "application/json", httpMethod = "GET")
    public ResponseResult<List<MealDetailVO>> mealDetail(@PathVariable("soleId") Long soleId) {

        return ResponseResult.success(clickMealService.mealDetail(soleId));
    }

}
